package lab02.test04;

import java.util.Scanner;

public class Employee {
    //1.属性
    String name;
    int num;
    float basicsalary;
    float salarygrowth;
    float salary;

    //2.方法
    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getNum() {
        return num;
    }

    public void setNum(int num) {
        this.num = num;
    }

    public float getBasicsalary() {
        return basicsalary;
    }

    public void setBasicsalary(float basicsalary) {
        this.basicsalary = basicsalary;
    }

    public void countSalaryGrowth() {
        //假定薪水增长与营业额相关
        Scanner SC = new Scanner(System.in);
        System.out.println("请输入营业额：");
        int businessvolume = SC.nextInt();
        if (businessvolume > 0 & businessvolume <= 1000) {
            salarygrowth = (float) (basicsalary * 0.1);
        }else if (businessvolume > 1000) {
            salarygrowth = (float) (basicsalary * 0.5);
        }else {
            System.out.println("default");
        }
    }

    public float countSalary() {
        salary = basicsalary + salarygrowth;
        return salary;
    }

    //3.构造函数
    Employee() {}

    @Override
    public String toString() {
        return "姓名：" + name + "\n" + "工号：" + num + "\n" + "工资：" + salary;
    }
}
